# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=mellowplayer
pkgver=3.6.5
pkgrel=0
pkgdesc="QT based cloud music integration for your desktop"
url="https://colinduquesnoy.gitlab.io/MellowPlayer/"
arch="all !ppc64le !s390x !armhf !mips !mips64" # mips, ppc64le and s390x blocked by qt5-qtwebengine missing, armhf blocked by qt5-qtdeclarative
license="GPL-2.0-or-later"
depends="qt5-qtgraphicaleffects qt5-qtquickcontrols qt5-qtsvg qt5-qtwayland"
makedepends="cmake qt5-qtdeclarative-dev qt5-qtquickcontrols2-dev qt5-qtbase-mysql
	qt5-qtbase-sqlite qt5-qtbase-postgresql qt5-qtbase-tds qt5-qtbase-odbc
	qt5-qtsvg-dev qt5-qttools-dev qt5-qtlocation-dev qt5-qtwebengine-dev
	qt5-qtwebchannel-dev libnotify-dev"
checkdepends="xvfb-run mesa-dri-gallium"
source="https://gitlab.com/ColinDuquesnoy/MellowPlayer/-/archive/$pkgver/MellowPlayer-$pkgver.tar.gz"
builddir="$srcdir/MellowPlayer-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DBUILD_TESTS=ON \
		$CMAKE_CROSSOPTS
	make -C build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="3023cb6cc107f60dfc781d6928467038351a31694185e4c86d92ef4689f93ff2860776ea81d2462e50eece3badab4488e02aafb115999fca438eac90f1be678d  MellowPlayer-3.6.5.tar.gz"
